package console;

import javax.swing.Box;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.text.MaskFormatter;

public class Container {

	private JLabel label1 = null;
	private JLabel label2 = null;
	private JFormattedTextField tx1 = null;
	private JFormattedTextField tx2 = null;
	private Box box = null;

	public Container(String labelText1, String labelText2) {
		box = Box.createHorizontalBox();

		label1 = new JLabel(labelText1);
		box.add(label1);

		tx1 = new JFormattedTextField(createFormatter("#"));
		tx1.setColumns(3);
		box.add(tx1);

		label2 = new JLabel(labelText2);
		box.add(label2);

		tx2 = new JFormattedTextField(createFormatter("#"));
		tx2.setColumns(3);
		box.add(tx2);
	}

	protected MaskFormatter createFormatter(String s) {
		MaskFormatter formatter = null;
		try {
			formatter = new MaskFormatter(s);
		} catch (java.text.ParseException exc) {
			System.err.println("formatter is bad: " + exc.getMessage());
			// System.exit(-1);
		}
		return formatter;
	}

	public JFormattedTextField getTx1() {
		return tx1;
	}

	public void setTx1(JFormattedTextField tx1) {
		this.tx1 = tx1;
	}

	public JFormattedTextField getTx2() {
		return tx2;
	}

	public void setTx2(JFormattedTextField tx2) {
		this.tx2 = tx2;
	}

	public JLabel getLabel1() {
		return label1;
	}

	public void setLabel1(JLabel label1) {
		this.label1 = label1;
	}

	public JLabel getLabel2() {
		return label2;
	}

	public void setLabel2(JLabel label2) {
		this.label2 = label2;
	}

	public Box getBox() {
		return box;
	}

	public void setBox(Box box) {
		this.box = box;
	}

}
